<html>
<head>
<script type="text/javascript" src="../bibliotheques/jquery.js"></script>
<script type="text/javascript" src="../bibliotheques/pause.js"></script>
<script type="text/javascript" src="../bibliotheques/jquery.blockUI.js.js"></script>
<script type="text/javascript" src="../jsGUIGuy/Misc.js"></script>
<script type="text/javascript" src="../jsGUIGuy/ServerInterface.js"></script>
<script type="text/javascript" src="../jsGUIGuy/User.js"></script>
<script type="text/javascript" src="../jsGUIGuy/PatternMapping.js"></script>
<script type="text/javascript" src="../jsGUIGuy/GUIAttributes.js"></script>
<script type="text/javascript" src="../jsGUIGuy/GUI.js"></script>
<script type="text/javascript" src="../jsGUIGuy/GUIList.js"></script>
<script type="text/javascript" src="../jsGUIGuy/GUIEvents.js"></script>
</head>
<body>

<h2>Test 1 : Attributes serialization test</h2>
<div id="log" style="font-family: arial; font-size:11px;">
</div>
<br><br>

<div class="patternContainer">
  <h2>Test 2 : Load data,one object, no remote source</h2>
  <div id="patternTaskForm" class="todo" style="display:none;">
      <form>
          <input type="hidden" data="unique_id" class="unique_id">
          <input type="hidden" data="object_id" class="object_id">
          <input type="hidden" data="deleted" class="deleted">
          <input type="checkbox" data="Done" dataType="Boolean" class="cbtodo Done" onChange="applyEditGUI(this)">
          <input type="text" data="Name" dataType="Text" class="todo_champ_form Name" onChange="applyEditGUI(this)">
          <div class="detail_todo" style="font-style: italic">Cr&eacute;e le <span data="created_at" class="created_at"></span></div>
          <div class="detail_todo" style="font-style: italic">Termin&eacute;e le <span data="Done_date" class="Done_date"></span></div>
      </form>
  </div>	
</div>
<br><br>


<div class="patternContainer">
  <h2>Test 3 : Load data, list of objects, no remote source</h2>
  <div id="patternTaskForm2" class="todo" style="display:none;">
      <form>
          <input type="hidden" data="unique_id" class="unique_id">
          <input type="hidden" data="object_id" class="object_id">
          <input type="hidden" data="deleted" class="deleted">
          <input type="checkbox" data="Done" dataType="Boolean" class="cbtodo Done" onChange="applyEditGUI(this)">
          <input type="text" data="Name" dataType="Text" class="todo_champ_form Name" onChange="applyEditGUI(this)">
          <div class="detail_todo" style="font-style: italic">Cr&eacute;e le <span data="created_at" class="created_at"></span></div>
          <div class="detail_todo" style="font-style: italic">Termin&eacute;e le <span data="Done_date" class="Done_date"></span></div>
      </form>
  </div>	
</div>

<script type="text/javascript">

  //Attributes serialization test
  var tester = new GUI({"unique_id": "2", "object_id": "3", "parent": "1", "object_type": "tester", "deleted": "0", "order_rank": "0", "deleted_at": "2007-12-12 12:12:12", "created_at": "2007-12-12 12:12:12", "attributes": [{"name":"Att1","value":"toto","data_type":"Text"},{"name":"Att2","value":"2","data_type":"Int"},{"name":"Att3","value":"2.23","data_type":"Double"}]});
  document.getElementById("log").innerHTML = tester.serialize() + "<br>";
  document.getElementById("log").innerHTML += tester.toJSON();
  
	//Load data,one object, no remote source
  var tester2 = new GUI({"unique_id": "2", "object_id": "3", "parent": "1", "object_type": "task", "deleted": "0", "order_rank": "0", "deleted_at": "2007-12-12 12:12:12", "created_at": "2007-12-12 12:12:12", "attributes": [{"name":"Done","value":"1","data_type":"Boolean"},{"name":"Name","value":"Faire plein d'autres tests !","data_type":"Text"},{"name":"Done_date","value":"2007-12-12 12:12:12","data_type":"DateTime"}]});
  tester2.getPatternId = function (viewName)
  {
    switch (viewName)
    {
      case "form" :
        return "patternTaskForm";
        break;
      default :
        break;
    }
  };
  
  tester2.goToView("form");
  
	//Load data, list of objects, no remote source
	var tester3 = new GUIList();
  tester3.setDataSource("tester_source.html");
  tester3.loadData("Tasks");
	tester3.ready(function () {
          tester3.getPatternId = function (viewName)
                {
                  switch (viewName)
                  {
                    case "form" :
                      return "patternTaskForm2";
                      break;
                    default :
                      break;
                  }
                };
        tester3.goToView("form");});  
	

</script>
</body>
</html>